package com.zking.ssm.sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zking.ssm.sys.mapper.HotelSellerEmployeeMapper;
import com.zking.ssm.sys.model.HotelSellerEmployee;
import com.zking.ssm.sys.service.IHotelSellerEmployeeService;
import com.zking.ssm.util.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HotelSellerEmployeeServiceImpl implements IHotelSellerEmployeeService {

    @Autowired
    private HotelSellerEmployeeMapper hotelSellerEmployee;




    @Override
    public int deleteByPrimaryKey(Long id) {
        return hotelSellerEmployee.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(HotelSellerEmployee record) {
        return hotelSellerEmployee.insert(record);
    }

    @Override
    public int insertSelective(HotelSellerEmployee record) {
        return hotelSellerEmployee.insertSelective(record);
    }

    @Override
    public HotelSellerEmployee selectByPrimaryKey(Long id) {
        return hotelSellerEmployee.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(HotelSellerEmployee record) {
        return hotelSellerEmployee.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(HotelSellerEmployee record) {
        return hotelSellerEmployee.updateByPrimaryKey(record);
    }

    @Override
    public List<HotelSellerEmployee> list(HotelSellerEmployee hotelSellerEmploye, PageBean pageBean) {
        if (null != pageBean && 0 != pageBean.getRows()) {
            PageHelper.startPage(pageBean.getPage(), pageBean.getRows());
        }
        List<HotelSellerEmployee> list = hotelSellerEmployee.list(hotelSellerEmploye);
        if (null != pageBean && 0 != pageBean.getRows()) {
            PageInfo pageInfo = new PageInfo(list);
            pageBean.setTotal(pageInfo.getTotal() + "");
        }
        return list;
    }


}
